<template>
  <div id="app">
    <ul>
      <li v-for="(item, index) in arr" :key="index">
        <span> {{ item }}</span>
        <button @click="del">删除</button>
      </li>
    </ul>
    <button @click="add(index)">生成</button>
  </div>
</template>

<script>
   export default {
      data() {
         return {
           arr: [1, 3, 5, 7, 9]
         }
      },
      methods: {
          add() {
              this.arr.push(Math.floor(Math.random()*10))
          },
          del(ind){
              this.arr.splice(ind, 1)
          }
      }
   }
</script>

<style>
</style>
